<?php

namespace App\Http\Controllers\Wechat;

use App\Http\Controllers\Controller;
use App\Models\Region;
use Illuminate\Http\Request;


class RegionController extends Controller
{
    // 省列表
    public function province()
    {
        return $this->writeJson(0, Region::getListProvince());
    }

    // 市列表
    public function city(Request $request)
    {
        $province_id = $request->post('province_id');
        return $this->writeJson(0, Region::getListCity($province_id));
    }

    // 区列表
    public function area(Request $request)
    {
        $city_id = $request->post('city_id');
        return $this->writeJson(0, Region::getListArea($city_id));
    }
}
